#pragma once

#include <QOpenGLWidget>
#include "include/Editor.h"

class my_QOpenGLWidget : public QOpenGLWidget
{
	Q_OBJECT

public:

	my_QOpenGLWidget(QWidget *parent);
	~my_QOpenGLWidget();

	void initializeGL() override;
	void resizeGL(int width, int height) override;
	void paintGL() override;

    void mousePressEvent(QMouseEvent*) override;
    void mouseMoveEvent(QMouseEvent*) override;
    void mouseReleaseEvent(QMouseEvent*) override;
    void keyPressEvent(QKeyEvent*) override;

    ACCAD::Editor editor;
    uint w, h;
    
private slots:
	void create_rectangle_slot();
	void create_circle_slot();	
	void create_line_slot();
	void revise_color_slot();
	void create_polygon_slot();
	void create_pen_slot();

	void undoAction();
    void redoAction();

    void new_file_slot(unsigned int width, unsigned int height);
	void openFile(QString location);
	void saveFile(QString location);
	void saveasFile(QString location);
	void setForegroundColor(const QColor& color);
	void SetPenWidth(unsigned int width); 
	void setBackgroundColor(const QColor& color);
    void delete_slot();

    void query_is_dirty_slot();
signals:
    void is_dirty(bool);
};

